/*
 * dist_emulator.h
 *
 *  Created on: Dec 9, 2012
 *      Author: andrey
 */

#ifndef DIST_EMULATOR_H_
#define DIST_EMULATOR_H_

#include "main.h"

/**
 * this is RPM. 10000 rpm is only 166Hz, 800 rpm is 13Hz
 */
#define DE_REVOLUTION_PERIOD 600

#define DE_IO_PORT GPIOA

// ECU pin 2E (this one blinks four times)
#define DE_WHITE_WIRE_PIN DE_PA6
// ECU pin 2G (distr G - this one blinks once)
#define DE_Y_BL_WIRE_PIN DE_PA7


// number of system ticks in one period of given frequency (per second)
#define freq2wave(freq) (((myfloat)CH_FREQUENCY) / (freq))


void initDistributorEmulator();
void setRevolutionPeriod(int value);
int getRevolutionPeriod();


#endif /* DIST_EMULATOR_H_ */
